home *** CD-ROM | disk | FTP | other *** search
/ Night Owl's Games 2 / Night Owl's Shareware (NOPV_GAMES 2) Games Disc II (Night Owl) (1994).iso / 015a / sbs25.zip / BASEBALL.INF < prev    next >
Text File  |  1993-11-16  |  14KB  |  309 lines

  1. BASEBALL.INF
  2. February 22, 1993
  3.  
  4.                     JUST HOW DOES THIS THING WORK?
  5.  
  6. A few people have asked how SBS goes about simulating a game, so I
  7. decided to write down a few notes for those interested.
  8.  
  9.  
  10. HITTING vs PITCHING - the first step:
  11.  
  12. A hitter can do one of six things in SBS. He can:
  13.   1) Make an out.
  14.   2) Get a walk.
  15.   3) Get a single.
  16.   4) Get a double.
  17.   5) Get a triple.
  18.   6) Get a Home Run.
  19. (He could also get on base on an error but that is really a subset of
  20. making an out). SBS calculates from the hitter's record the probability
  21. of each occurrence. Then the pitcher's record is considered which
  22. modifies the probabilities. This will be demonstrated by working through
  23. an example. Consider the batter Joe Hitter:
  24.  
  25.              AB  Hits 2B  3B  HR  BB  K   AVG
  26. Joe Hitter  482  147  20   4  12  41  71 .305
  27.  
  28. Compute PA (Plate Appearances) = AB + BB = 523
  29.   (ignore sacrifice hits and Hit By Pitched Balls which would make PA a
  30.   little larger)
  31. Compute HBB (probability of Walk) = BB / PA                       = .078
  32. Compute H1 (probability of single) = (Hits - (2B + 3B + HR)) / PA = .212
  33. Compute H2 (probability of double) = 2B / PA                      = .038
  34. Compute H3 (probability of triple) = 3B / PA                      = .007
  35. Compute H4 (probability of HR) = HR / PA                          = .023
  36.                                                                  -------
  37.                                                                     .358
  38.  
  39. What's left is the probability of making an out (or possibly getting on
  40. on an error): 1.000 - .358                                        = .642
  41.  
  42. We have determined Joe's probabilities as a whole against all the
  43. pitchers he faced that particular season. But now we have to calculate
  44. probabilities given a particular pitcher. Consider Jack Pitcher:
  45.  
  46.               IP  Hits  HR  BB  K
  47. Jack Pitcher 200  210   15  50  80
  48.  
  49. If a pitcher threw 200 innings we know he got approximately 600 batters
  50. out. The ones he did not get out got hits or walks or reached on errors.
  51.  
  52. Compute BF (batters faced) = (IP x 3) + Hits + BB
  53.  
  54. Sometimes a pitcher gets a few extra outs such as double plays and
  55. runners getting thrown out on the bases. On the other hand sometimes he
  56. faces extra hitters because his defense makes errors. These two factors
  57. just about cancel each other out so we can leave the BF equation alone.
  58.                        
  59. We now need to compute the probabilities for the pitcher for the same
  60. events that we calculated for the batter.
  61.  
  62. Compute BF (batters faced) = (IP x 3) + Hits + BB = 860
  63.  
  64. Compute PBB (probability of Walk) = BB / BF                      = .0581
  65. Compute P1 (probability of single) =  Hits x .717 / BF           = .1751
  66. Compute P2 (probability of double) =  Hits x .174 / BF           = .0425
  67. Compute P3 (probability of triple) =  Hits x .024 / BF           = .0059
  68. Compute P4 (probability of HR) = HR / BF                         = .0174
  69.  
  70. The statistics do not usually tell us how many singles, doubles and
  71. triples a pitcher allowed. Usually just the totals hits and home runs
  72. are given. However, we can use the multipliers .717, .174 and .024 to
  73. estimate singles, doubles and triples from the total number of hits.
  74. [If all "HR's allowed" are zero in the .DAT file, SBS uses a "league
  75. average" for P4 found from data in the .CFG file. This essentially
  76. removes any influence a pitcher has over this statistic, however].
  77.  
  78. Comparing the percentages we obtained from the hitter with the pitcher
  79. we have come up with the following:
  80.  
  81. Event       Hitter       Pitcher
  82. ------      ------       -------
  83. walk         7.72%         5.81%
  84. single      20.90%        17.51%
  85. double       3.77%         4.25%
  86. triple       0.75%         0.59%
  87. home run     2.26%         1.74%
  88. out         64.60%        70.10%
  89.  
  90. At first glance it might seem that all we need to do now is average the
  91. hitters and pitchers events like this:
  92.  
  93. single = (20.9% + 17.51%) / 2 = 19.21%
  94. etc. for the rest of the events
  95.  
  96. This method is unacceptable, however, because it penalizes the outstanding
  97. players and rewards the poor players. That is, it tends to lump everyone
  98. together too much. In our example above we have a good hitter, (.305 vs
  99. the league) against a quite average pitcher. Certainly we could not
  100. expect his single% to DROP to 19.21% from 20.90%! After all if this is
  101. an average pitcher we would expect our batter to do at least as well
  102. against him as he did against the rest of the league!
  103.  
  104. The solution is to use "league averages" for the events and to compare
  105. our pitcher's performance against the league averages. For example, we
  106. can pick up a baseball magazine containing the statistics from the
  107. preceding year, and calculate the total "batter's faced" for all the
  108. pitchers for the entire season. We can also total the number of walks,
  109. hits, and home runs -- and estimate using our multipliers above -- the
  110. total number of singles, doubles, and triples. Then we can calculate our
  111. "league averages".
  112.  
  113. For example, we find that for an entire season there was 17,500 innings
  114. pitched, 16,500 hits, 1450 Home Runs, 6,300 walks. Calculate League
  115. Averages:
  116.  
  117.   League Avg. BF = 17,500 x 3 + 16,500 +  6,300 = 75,300
  118.  
  119.    " " " "    LABB     =         6,300 / 75,300 = .0837
  120.    " " " "    LA1      = .717 x 16,500 / 75,300 = .1571
  121.    " " " "    LA2      = .174 x 16,500 / 75,300 = .0381
  122.    " " " "    LA3      = .024 x 16,500 / 75,300 = .0053
  123.    " " " "    LA4      =         1,450 / 75,300 = .0193
  124.  
  125. Now we can combine our hitter percentages with our pitcher percentages
  126. to get meaningful probabilities:
  127.  
  128. Combined percentages:
  129. walk%     = HBB * (PBB / LABB)  = .0536
  130. single%   = H1  * (P1  / LA1)   = .2329
  131. double%   = H2  * (P2  / LA2)   = .0421
  132. triple%   = H3  * (P3  / LA3)   = .0083
  133. home run% = H4  * (P4  / LA4)   = .0204
  134.  
  135. Note that if the pitcher's percentages are nearly equal to the League
  136. Averages, the second factor becomes essentially 1 and the hitter
  137. performs as expected. But if the pitcher's percentages are substantially
  138. better (lower) than the League Averages, the second factor will be less
  139. than 1 and the hitter will suffer. The reverse is true if the pitcher's
  140. percentages are worse (larger) than the League Averages.
  141.  
  142.  
  143. RIGHTYS VS LEFTYS - the second step:
  144.  
  145. The example above is the basis of how a given hitter is expected to
  146. perform against a given pitcher. But we also can fine-tune our model to
  147. correct for the baseball maxim that right-handed batters do better
  148. against left-handed pitchers and vice-versa. [A batter facing a
  149. like-handed pitcher suffers somewhat]. This is, of course, a very
  150. individual thing -- not affecting some players while severely affecting
  151. others. SBS does not know which players are exceptional in this area --
  152. the data files do not show a break down versus right or left handed
  153. opponents. But we can make some broad assumptions which are useful in
  154. large simulations.
  155.  
  156. Approximately two-thirds of innings pitched are by right-handers.
  157. Because a typical batter will see so much more right-handed pitching
  158. than left-handed pitching, his average vs. left-handed pitching will
  159. show a greater fluctuation.
  160.  
  161. Consider the following typical scenario for a RIGHT-handed hitter:
  162.  
  163.                               AB   Hits  Avg.
  164.                             _________________
  165.  Total                     | 600   180  .300
  166.                            |
  167.  vs. Right-Handed Pitching | 400   116  .290
  168.                            |
  169.  vs. Left-Handed Pitching  | 200    64  .320
  170.  
  171. Notice that his boost vs left-handed pitching (20 points) is twice that
  172. of his penalty vs. right-handed pitching (10 points). This is because he
  173. sees twice as much right-handed pitching over the course of a season.
  174.  
  175. For the typical LEFT-handed hitter:
  176.  
  177.                               AB   Hits  Avg.
  178.                             _________________
  179.  Total                     | 600   180  .300
  180.                            |
  181.  vs. Right-Handed Pitching | 400   124  .310
  182.                            |
  183.  vs. Left-Handed Pitching  | 200    56  .280
  184.  
  185. Notice that his penalty vs left-handed pitching (20 points) is twice
  186. that of his boost vs. right-handed pitching (10 points). Again, this is
  187. because a full-time player sees twice as much right-handed pitching as
  188. left-handed pitching.
  189.  
  190. Actually SBS does not reward and/or penalize by an absolute number of
  191. batting "points" but instead increases or decreases each of the hitter's
  192. probabilities by a percentage. Version 2.0 uses 3% and 6% for the
  193. percentages to reward or penalize. This adjustment is spread out among
  194. all the types of hits, not just singles.
  195.  
  196.  
  197. PITCHER FATIGUE FACTOR - the third step:
  198.  
  199. We have looked at two of the three major factors used in determining the
  200. percentages of events. The last major factor is the Pitcher Fatigue
  201. factor.  That is, how does the effectivity of a pitcher vary over the
  202. course of a game -- or when does he tire out. SBS uses a linear function
  203. for pitcher fatigue which makes a pitcher more effective than normal if
  204. the pitcher has worked less than about 4 innings and less effective than
  205. normal if the pitcher has worked more than about 4 innings.  However SBS
  206. treats starting pitchers differently from relievers.  SBS assumes
  207. relievers tire more quickly so the break-off point is about 2 innings
  208. instead of 4.
  209.  
  210.  
  211. PUTTING IT ALL TOGETHER:
  212.  
  213. Lets say we now have arrived at our five percentages and have adjusted
  214. them the way we want for the righty/lefty effect and the pitcher fatigue
  215. effect. We now need to "stack" them on top of each other and calculate
  216. the "break" points.  Now the percentages are some fraction between 0 and
  217. 1.
  218.  
  219. bk1 = walk%
  220. bk2 = bk1 + single%
  221. bk3 = bk2 + double%
  222. bk4 = bk3 + triple%
  223. bk5 = bk4 + home run%
  224.  
  225. We now call our random number function which returns a (pseudo) random
  226. number between 0 and 1 -- and compare it with our break points. If "x"
  227. is our random number:
  228.  
  229. If x is greater than 0   but less than bk1 --> walk
  230. If x is greater than bk1 but less than bk2 --> single
  231. If x is greater than bk2 but less than bk3 --> double
  232. If x is greater than bk3 but less than bk4 --> triple
  233. If x is greater than bk4 but less than bk5 --> home run
  234. If x is greater than bk5 but less than 1   --> out OR on by error
  235.  
  236. Handling the "outs" is a matter of deciding to which defensive player
  237. the ball was hit, whether or not it was a ground ball or a fly ball, and
  238. whether or not the defensive man handled it cleanly.
  239.  
  240.  
  241. SPEED/STOLEN BASES:
  242.  
  243. The .dat files contain a column for stolen bases which SBS translates
  244. (via a formula) into a general purpose speed rating (1-9). You can view
  245. this speed rating by popping up your lineup or the opponent's lineup.
  246. The numbers 1 through 9 are roughly proportional to a player's chances
  247. of stealing 2nd or 3rd base. That is, a player with a speed rating of 9
  248. would have approximately a 90% chance of stealing 2nd or 3rd. A rating
  249. of 5 would be a 50% chance, etc. If the opponent calls a pitch-out the
  250. chance of success is reduced by 25% (but the chance of walking the
  251. batter increases by 25%). The chance of success is also reduced if a
  252. runner on 1st is trying to steal against a left-handed pitcher or a
  253. runner or 2nd is trying to steal against a right-handed pitcher.
  254.  
  255. The formula to calculate the speed rating from the .dat file information
  256. estimates the number of times the player made it to first base (ABs,
  257. singles & BBs) and then multiplies that by a fraction to estimate the
  258. number of steal opportunities the player might have had. Then it compares
  259. that estimate to the number of stolen bases and assigns a speed rating.
  260. The method is somewhat crude in that is penalizes fast players that
  261. happen to play on teams that just do not attempt to steal. On the other
  262. hand it helps players who are efficient at stealing bases even if they
  263. are not actually all that fast.
  264.  
  265. The speed rating has other uses beside the stolen base. It helps
  266. determine the likelihood of the player hitting into a double play or
  267. successfully executing a drag bunt. It also helps determine if a runner
  268. goes from 1st to 3rd on a single or scores from 2nd on a single. Or if a
  269. runner on 1st can score on a double. (The number of outs and where the
  270. ball is hit is a big factor also. For example, runners tend to play it
  271. safe with no outs but usually will try to take the extra base with two
  272. out).
  273.  
  274.  
  275. INFIELD "IN":
  276.  
  277. This defensive strategy will cut off almost all runners who would
  278. otherwise score on a ground ball to an infielder [especially to the
  279. shortstop or second baseman].  The penalty is that the batter's base-hit
  280. percentages are adjusted upward dramatically because more ground balls
  281. will go through the infield.  A .250 hitter becomes a .350 hitter. [When
  282. the player or the automatic manager chooses to play the infield in, it
  283. is only in effect for the current batter].
  284.  
  285.  
  286. AUTOMATIC MANAGER:
  287.  
  288. SBS has not yet been programmed for brilliant management, but it does
  289. make most basic offensive and defensive maneuvers. On defense SBS can:
  290.  1) pull infield in
  291.  2) call for a pitch-out
  292.  3) evaluate pitcher and go to the bullpen if necessary
  293.  
  294. On offense SBS can:
  295.  1) pinch hit if a suitable pinch hitter is available
  296.  2) sacrifice bunt or squeeze bunt
  297.  3) steal
  298.  
  299. That's about it at the present time. The automatic manager does no pinch
  300. running or double-switch stuff. No "chess games" vs the other side. You
  301. will find that on offense the automatic manager is fairly aggressive. He
  302. is not shy about trying to steal bases or squeeze home a run.
  303.  
  304.  
  305. HAVE FUN:
  306.  
  307. Well, that's about all I care to write for now. If you have any
  308. questions, feel free to write.
  309.